﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shotter : Base_
{
    private float attackCD = 1.4f;
    Vector2 firepos=new Vector2(0.579f,0.367f);
    public override void InitForPlace(Grid grid)
    {
        hp = 300;
        currGrid = grid;
        transform.position = grid.wordPoint;
        currGrid.CurrPlantBase = this;
        sprite.sortingOrder = 0;
        InvokeRepeating("Attack", 0,0.2f);
    }
    /// <summary>
    /// 判断
    /// </summary>
    void Attack()
    {
       Zomble zomble= ZmobleManager.instance.GetZombleMin((int)currGrid.Point.y, transform.position);
       if (zomble == null) return;
       if (zomble.currGrid.Point.x == 8 && Vector2.Distance(zomble.transform.position, zomble.currGrid.wordPoint) > 1.5f) return;

    }
}
